<!DOCTYPE html>
<html lang="cn">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <script>
        function sum(num) {
            return new Promise(resolve => {
                setTimeout(() => {
                    let count = 0;
                    for (let i = 0; i < num; i++) {
                        count += num--;
                    }
                    resolve(count);
                })
            });
        }
        async function hd(num) {
            let res = await sum(num);
            console.log(res);
        }
        hd(13434340);

        // async function hd() {
        //     let res = await Promise.resolve().then((res) => {
        //         return 30;
        //     });
        //     console.log(res);
        // }
        // hd();

        // console.log('sdf')
    </script>
</body>

</html>